package pers.course.others;

import java.util.Scanner;

public class ReversePair {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = 0;
        int num = in.nextInt();
        int[] a = new int[10000];
        for (int i = 0; i < num; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < num; i++) {
            for (int j = i + 1; j < num; j++) {
                if (a[i] > a[j]) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
